from sqlalchemy import Column, String, DECIMAL, DateTime, func, DATE, Date
from sqlalchemy.dialects.mysql import TINYINT, BIGINT
from pydantic import BaseModel
from server.model import BaseOrm
from server import db, WeChat_pay


class OrderStatus:
    Not = 0
    Handing = 1
    Finished = 2
    Reject = 3
    Pending = 4


# 订单
class Order(BaseOrm):
    __tablename__ = 'm_order'
    user_id = Column(BIGINT(20, unsigned=True), nullable=False, server_default='0', comment="用户id")
    user_name = Column(String(32), nullable=False, server_default='', comment="用户名称")
    phone = Column(String(16), nullable=False, server_default='', comment="联系电话")
    address = Column(String(200), nullable=False, server_default='', comment="用户名称")
    referrer = Column(String(32), nullable=False, server_default='', comment="推荐人")
    desc = Column(String(2000), nullable=False, server_default='', comment="办理情况")
    acceptor_id = Column(String(2000), nullable=False, server_default='', comment="受理人id")
    acceptor_name = Column(String(2000), nullable=False, server_default='', comment="受理人id")

    complete_desc = Column(String(2000), nullable=False, server_default='', comment="完成情况")

    evaluation = Column(TINYINT, nullable=False, server_default='0', comment="客户评价，星级")
    evaluation_desc = Column(String(2000), nullable=False, server_default='', comment="完成情况")

    status = Column(TINYINT(unsigned=True), nullable=False, server_default="0",
                    comment="状态: 0:未受理 1:处理中 2:已完成 3:已拒绝 4：挂起")
    remark = Column(String(64), nullable=False, server_default='', comment="备注")


db.create_all()
